package io.nutz.nutzsite.module.signin.models;

import io.nutz.nutzsite.common.utils.StringUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Comment;
import org.nutz.dao.entity.annotation.Default;
import org.nutz.dao.entity.annotation.EL;
import org.nutz.dao.entity.annotation.Many;
import org.nutz.dao.entity.annotation.Name;
import org.nutz.dao.entity.annotation.Prev;
import org.nutz.dao.entity.annotation.Table;
		
/**
 * 签到任务表 signin_snpub
 * 
 * @author lrw
 * @date 2020-02-29
 */
@Table("signin_snpub")
public class Snpub implements Serializable {
	private static final long serialVersionUID = 1L;

	@Many(field = "snid")//从表指定的字段指向当前表主键
    private List<Sned> sneds;
	
			@Name
		@Column("id")
	@Comment("签到ID")
	@Prev(els=@EL("$me.genID()"))			
	private String id;
			public String genID(){
			    return StringUtils.get17timeid();
			}
	@Column("title")
	@Comment("签到名称")
	private String title;			


	@Column("hasobj")
	@Comment("是否指定签到对象1指定0不指定")
	@Default("1")
	private boolean hasobj;

			/** 签到对象 */
	@Column("snobj")
	@Comment("签到对象")
	private String snobj;

			/** 签到形式 */
	@Column("sntype")
	@Comment("签到形式")
	private String sntype;

	@Column("hasendtime")
	@Comment("是否手动结束1指定时间0手动")
	@Default("1")
	private boolean hasendtime;

			/** 签到开始时间 */
	@Column("snstarttime")
	@Comment("签到开始时间")
	private Date snstarttime;

			/** 签到结束时间 */
	@Column("snendtime")
	@Comment("签到结束时间")
	private Date snendtime;
	
	@Column("createby")
	@Comment("发布人")
	private String createby;
	
	@Column
	@Comment("已签人数")
	@Default("0")
	private Integer ontimesn;
	@Column
	@Comment("签迟到人数")
	@Default("0")
	private Integer latesn;
	@Column
	@Comment("未签到人数")
	@Default("0")
	private Integer absentsn;
	
	public void setId(String id) 
	{
		this.id = id;
	}

	public String getId() 
	{
		return id;
	}



	public void setSnobj(String snobj) 
	{
		this.snobj = snobj;
	}

	public String getSnobj() 
	{
		return snobj;
	}

	public void setSntype(String sntype) 
	{
		this.sntype = sntype;
	}

	public String getSntype() 
	{
		return sntype;
	}



	public void setSnstarttime(Date snstarttime) 
	{
		this.snstarttime = snstarttime;
	}

	public Date getSnstarttime() 
	{
		return snstarttime;
	}

	public void setSnendtime(Date snendtime) 
	{
		this.snendtime = snendtime;
	}

	public Date getSnendtime() 
	{
		return snendtime;
	}

	public boolean isHasobj() {
		return hasobj;
	}

	public void setHasobj(boolean hasobj) {
		this.hasobj = hasobj;
	}

	public boolean isHasendtime() {
		return hasendtime;
	}

	public void setHasendtime(boolean hasendtime) {
		this.hasendtime = hasendtime;
	}

	public String getCreateby() {
		return createby;
	}

	public void setCreateby(String createby) {
		this.createby = createby;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public List<Sned> getSneds() {
		return sneds;
	}

	public void setSneds(List<Sned> sneds) {
		this.sneds = sneds;
	}

	public Integer getOntimesn() {
		return ontimesn;
	}

	public void setOntimesn(Integer ontimesn) {
		this.ontimesn = ontimesn;
	}

	public Integer getLatesn() {
		return latesn;
	}

	public void setLatesn(Integer latesn) {
		this.latesn = latesn;
	}

	public Integer getAbsentsn() {
		return absentsn;
	}

	public void setAbsentsn(Integer absentsn) {
		this.absentsn = absentsn;
	}

	@Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("hasobj", isHasobj())
            .append("snobj", getSnobj())
            .append("sntype", getSntype())
            .append("hasendtime", isHasendtime())
            .append("snstarttime", getSnstarttime())
            .append("snendtime", getSnendtime())
            .toString();
    }
}
